from ast import Assign, AnnAssign, Call, List
from typing import Union


def should_increase_refcnt(assign_node: Union[Assign, AnnAssign]):
    """
    If the right value of assign is Call or List, it indicates that the object was just created and has initial
    reference count 1.

    So the reference count of right value should not be increased in the assignment sentence.

    :param assign_node:
    :return:
    """
    assert isinstance(assign_node, (Assign, AnnAssign))

    if not isinstance(assign_node.value, (Call, List)):
        return True
    else:
        return False
